package com.alibaba.travel.search.entity;


import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: where
 * @Date: 2023/03/08/15:43
 * @Description:
 */
@Document(indexName = "article")
@Data
@ApiModel(description = "ES文章实体类")
public class EsArticle implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     *
     */
    @ApiModelProperty(value="",name="id")
    @Field(type = FieldType.Long)
    private Long id;
    /**
     * 文章标题
     */
    @ApiModelProperty(value="文章标题",name="title")
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String title;

    @ApiModelProperty(value="文章标题")
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String content;

    /**
     * 更新时间
     */
    @ApiModelProperty(value="更新时间",name="updateTime")
    @Field(type = FieldType.Date,
            pattern = "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis")
    private Date updateTime;

    /**
     * 创建时间
     */
    @ApiModelProperty(value="创建时间",name="createTime")
    @Field(type = FieldType.Date,
            pattern = "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis")
    private Date createTime;
    /**
     * 文章发布人
     */
    @ApiModelProperty(value="文章发布人",name="userId", required = false)
    @Field(type = FieldType.Long)
    private Long userId;
    /**
     * 文章发布人昵称
     */
    @ApiModelProperty(value="文章发布人")
    @Field(type = FieldType.Keyword)
    private String userName;
    /**
     * 发布人头像
     */
    @ApiModelProperty(value="发布人头像", required = false)
    @Field(type = FieldType.Keyword, index = false)
    private String avatar;
    /**
     * mongo内容id
     */
    @ApiModelProperty(value="mongo内容id",name="contentId")
    @Field(type = FieldType.Long)
    private String contentId;
    /**
     * 文章点赞数
     */
    @ApiModelProperty(value="文章点赞数",name="likesNumber")
    @Field(type = FieldType.Long)
    private Long likesNumber = Long.valueOf(0);
    /**
     * 书籍封面照片
     */
    @ApiModelProperty(value="书籍封面照片",name="coverImage")
    @Field(type = FieldType.Keyword, index = false)
    private String coverImage;


    /**
     * 文章状态（0代表public 1代表private）
     */
    @ApiModelProperty(value="文章状态（0代表public 1代表private）",name="showStatus", required = true)
    @Field(type = FieldType.Keyword)
    private String showStatus = "0";

    @ApiModelProperty(value="文章评论数")
    @Field(type = FieldType.Long)
    private Long commentNumber = Long.valueOf(0);

    @ApiModelProperty(value = "标签列表")
    private List<ArticleTagEntity> tags;

    @ApiModelProperty(value = "专栏列表")
    private List<SpecialColumnEntity> columns;
}
